package com.bike.bikeserver.controller.frontend;

import com.bike.bikeserver.common.annotation.OperationLog;
import com.bike.bikeserver.common.core.domain.CommonResult;
import com.bike.bikeserver.service.IRewardsDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @version 1.0
 * @Author ZZX
 * @Date 2023/7/9 16:40
 */
@RestController
@RequestMapping("front/rewardsDetail")
public class RewardsDetailController
{
    @Autowired
    IRewardsDetailService rewardsDetailService;

    /**
     * 根据用户名获取奖券详情
     * @param nickName
     * @return
     */
    @OperationLog(value = "根据用户名获取奖券详情:rewards_detail")
    @GetMapping("getRewardsByNickName")
    public CommonResult getRewardsByNickName(@RequestParam("nickName") String nickName)
    {
        return rewardsDetailService.getRewardsListByNickName(nickName);
    }

    /**
     * 根据id更新奖券状态
     * @param id
     * @return
     */
    @OperationLog(value = "根据id更新奖券状态:rewards_detail")
    @PutMapping("updateRewardsStateById")
    public CommonResult updateRewardsStateById(@RequestBody Integer id)
    {
        return rewardsDetailService.updateRewardsStateById(id);
    }
}